<?php
/**
 * @package Joomla.JoomShopping.Products
 * @author Vadim Meling
 * @website http://dell3r.ru/
 * @email dell3r@yandex.ru
 * @copyright Copyright by Dell3r Ltd. All rights reserved.
 * @license The MIT License (MIT);
 */
Defined('_JEXEC') Or Die('Restricted access');

$VersionAddon	= "1.4";
$VersionJSh		= "3.7";
$VersionPlus	= "+";
$AddonName		= "Plus and Minus Count Product";
$AddonAlias		= "plus_minus_count_product";
$PluginDirs		= Array("JShoppingProducts", "JShoppingCheckout");

$DataBase = JFactory::getDBO();
ForEach($PluginDirs As $PluginDir){
	$PluginDir = StrToLower($PluginDir);
	$DataBase->setQuery("SELECT `element` FROM `#__extensions` WHERE `element` = \"".$AddonAlias."\" AND `folder` = \"".$PluginDir."\"");
	If (!Count($DataBase->loadObjectList())){
		$DataBase->setQuery("INSERT INTO `#__extensions` (`name`, `type`, `element`, `folder`, `enabled`, `access`, `protected`) VALUES
				(\"JoomShopping Plugin ".$AddonName."\", \"plugin\", \"".$AddonAlias."\", \"".$PluginDir."\", 1, 1, 0);");
		$DataBase->query();
	}
}

$Addon = JTable::getInstance("Addon", "JShop");
$Addon->loadAlias($AddonAlias);
$Addon->set("name", "Addon ".$AddonName);
$Addon->set("version", $VersionAddon." (".$VersionJSh.".x".$VersionPlus.")");
$Addon->set("uninstall", "/administrator/components/com_jshopping/install/addon_".$AddonAlias."_uninstall.php");
$Addon->store();
?>